package top.healthylife.gateway.platform.eye.api.api.jingyingfengxian;

import cn.hutool.core.bean.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.core.util.SystemConfigUtils;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.eye.api.config.SystemConfig;
import top.healthylife.gateway.platform.eye.api.util.OutHttpUtil;
import top.healthylife.gateway.platform.eye.dto.jingyingfengxian.EyeReqStockPledgeShareholderDetailDto.req.EyeReqStockPledgeShareDetailDto;
import top.healthylife.gateway.platform.eye.dto.jingyingfengxian.EyeReqStockPledgeShareholderDetailDto.res.EyeResStockPledgeShareDetailDto;

/**
* @author: GenUtil
* @date: 2020-12-15 19:07:12
*/
@Slf4j
@Service
@ApiServiceExplain(price = 10,docUrl ="http://open.tianyancha.com/open/1020",apiName = "重要股东质押详情[1020]", info = "根据重要股东质押统计（质押中）ID获取重要股东质押统计（质押中）详情，重要股东质押统计（质押中）详情包括股东名称、最新质押笔数、剩余质押股数等字段的详细信息")
public class EyeStockPledgeShareholderDetailApi implements ParentFace<EyeReqStockPledgeShareDetailDto, EyeResStockPledgeShareDetailDto> {

    static final String URL = "http://open.api.tianyancha.com/services/open/mr/stockPledge/shareholder/detail/2.0";

    /**
     * 执行这个服务接口
     * 如果成功，返回成功结果，如果接口错误，直接抛异常即可
     *
     * @param eyeDto 请求参数
     * @return 查询的真实结果，如果是失败，则直接返回异常即可
     */
    @Override
    public EyeResStockPledgeShareDetailDto execute(EyeReqStockPledgeShareDetailDto eyeDto) {
        //可直接通过工具类获取这个对象
        SystemConfig o = (SystemConfig) SystemConfigUtils.get();
        return OutHttpUtil.get(URL, BeanUtil.beanToMap(eyeDto), o, EyeResStockPledgeShareDetailDto.class);
    }
}
